from typing import List
from api.base.base_client import BaseClient


class AccountClient(BaseClient):
    """账号管理客户端"""

    def edit_account(self, token: str, account_id: str, customer_type: int,
                     department_ids: List[str], mobile: str, role_ids: List[str],
                     user_name: str) -> dict:
        """
        编辑账号信息
        :param token: 用户token
        :param account_id: 账号ID
        :param customer_type: 客户类型
        :param department_ids: 部门ID列表
        :param mobile: 手机号
        :param role_ids: 角色ID列表
        :param user_name: 用户名
        :return: 编辑结果
        """
        endpoint = f"/api/account/smart-rongmei/customer/edit/uic:{account_id}"
        data = {
            "customerType": customer_type,
            "departmentIds": department_ids,
            "mobile": mobile,
            "roleIds": role_ids,
            "userName": user_name
        }

        response = self._post(endpoint, data, token)
        response.raise_for_status()
        return response.get_data() or {}